/*手动开奖
 * 
 * 2017-11-17
 *
 */




$(function(){
	
	$.post("http://47.94.140.92:8080/JDLot/lottype/pagelist",{PageNum:1,PageSize:10},function(res){
				var res=eval('('+res+')');	
				var data=res.datas;
				console.log(data)
				$(".ciazhong").empty();
				var htmls="";
				for(var i=0;i<data.length;i++){  
		                    var item = data[i];
		                    var lottery_name=item.lottery_name;
		                    lottery_name=lottery_name.substring(5);
					htmls+='<option>'+lottery_name+'</option>';
				}
					
				
				$(".ciazhong").html(htmls)
	})
	
	
			 	
//				var phone=localStorage.getItem("phone");
				$("#submints").on('click',function(){//点击提交按钮执行登录验证
						runings()
				})

			 function runings(){
			 	var urlApi = 'https://jindi163.com:8443/JDLot/type/new/insert';
			 	var lottery_name=$(".ciazhong").val();
					var data_param=$("#detas_input").val();
					var period=$("#detas_input1").val();
					var number_param=$("#detas_input2").val();
					var time_current=$("#detas_input3").val();
					var time_next=$("#detas_input4").val();
					
			
					
					console.log(lottery_name+"+++"+data_param+"+++"+period+"+++"+number_param+"+++"+time_current+"+++"+time_next)
					
					 	$.ajax({
					 		url:urlApi,
					 		type:"post",
				            data:{
								"lottery_name":lottery_name,//彩票名称
								"data_param":data_param,//日期
								"period":period,//期数
								"number_param":number_param,//号码 手动输入
								"time_current":time_current,//开奖时间 具体到时分秒
								"time_next":time_next//下棋开奖时间
				            },
				            xhrFields: {
   						 withCredentials: true
						},
					crossDomain: true,
				            dataType:'json',
				            contentType:"application/json",
				            async:true,
				            cache:false,
				            success:function(res){

				            	if(res.msgContext=="datasSuc"){
				            		alert("手动开奖成功！")
				            	}else{
				            		alert("输入信息有误，请重新操作！")
				            	}
				            }
					 	})
	 }
})